package com.zyong.design.pattern.strategy.case2;

/**
 * @program: zyong-design-pattern
 * @ClassName: Client
 * @author: zyong
 * @create: 2024-04-14 01:04
 */
public class Client {
    public static void main(String[] args) {
        Receipt mt1011 = new Receipt("你好，绝密消息", "Mt1011");
        Receipt mt2101 = new Receipt("你好，绝密消息", "Mt2101");

        ReceiptHandleStrategy mt1011Strategy = ReceiptHandleStrategyFactory.getReceiptHandleStrategy(mt1011.getType());
        ReceiptHandleStrategy mt2101Strategy = ReceiptHandleStrategyFactory.getReceiptHandleStrategy(mt2101.getType());

        ReceiptStrategyContext receiptStrategyContext = new ReceiptStrategyContext(mt1011Strategy);
        receiptStrategyContext.handleReceipt(mt1011);

        receiptStrategyContext.setReceiptHandleStrategy(mt2101Strategy);
        receiptStrategyContext.handleReceipt(mt2101);
    }
}
